<?php
 class Student{
   public $name;//公有属性
   private $age;//私有属性,只能在内部访问
   function setAge($age){
      $this->age=$age;
   }
   function echoAge(){
       echo $this->age;
   }
 }
 
 $stu1=new Student();
 $stu1->name='zhangsan';
 echo $stu1->name;
//  echo $stu1->age;
 $stu1->setAge(18);
 $stu1->echoAge();



?>